/**
 * 此类中的char类型最好放置字母，便于排序查找等操作
 * @author moj
 */
public class Arrays {

    /**
     * 增加数值  无序数组
     * @author moj
     * 在指定位置增加一个数值
     * 数组a是无序数组
     */
    public void InsetU(byte[] a,int x,byte y){
        if(x<0 || x>=a.length){
            System.out.println("IndexOutOfBoundsException");
            return ;
        }
        for(int i=a.length-2;i>=x;i--){
            a[i+1] = a[i];
        }
        a[x]=y;
    }
    public void InsetU(short[] a,int x,short y){
        if(x<0 || x>=a.length){
            System.out.println("IndexOutOfBoundsException");
            return ;
        }
        for(int i=a.length-2;i>=x;i--){
            a[i+1] = a[i];
        }
        a[x]=y;
    }
    public void InsetU(int[] a,int x,int y){
        if(x<0 || x>=a.length){
            System.out.println("IndexOutOfBoundsException");
            return ;
        }
        for(int i=a.length-2;i>=x;i--){
            a[i+1] = a[i];
        }
        a[x]=y;
    }
    public void InsetU(long[] a,int x,long y){
        if(x<0 || x>=a.length){
            System.out.println("IndexOutOfBoundsException");
            return ;
        }
        for(int i=a.length-2;i>=x;i--){
            a[i+1] = a[i];
        }
        a[x]=y;
    }
    public void InsetU(float[] a,int x,float y){
        if(x<0 || x>=a.length){
            System.out.println("IndexOutOfBoundsException");
            return ;
        }
        for(int i=a.length-2;i>=x;i--){
            a[i+1] = a[i];
        }
        a[x]=y;
    }
    public void InsetU(double[] a,int x,double y){
        if(x<0 || x>=a.length){
            System.out.println("IndexOutOfBoundsException");
            return ;
        }
        for(int i=a.length-2;i>=x;i--){
            a[i+1] = a[i];
        }
        a[x]=y;
    }
    public void InsetU(char[] a,int x,char y){
        if(x<0 || x>=a.length){
            System.out.println("IndexOutOfBoundsException");
            return ;
        }
        for(int i=a.length-2;i>=x;i--){
            a[i+1] = a[i];
        }
        a[x]=y;
    }
    /**
     * 有序数组插入一个值
     * @param a
     * @param y
     * @param t
     */
    public void InsetO(byte[] a,byte y,boolean t){
        int k = CheckO(a,y,t);
        if(k<0 || k>=a.length){
            System.out.println("IndexOutOfBoundsException");
            return;
        }
        for(int i=a.length-2;i>=k;i--){
            a[i+1] = a[i];
        }
        a[k]=y;
    }
    public void InsetO(short[] a,short y,boolean t){
        int k = CheckO(a,y,t);
        if(k<0 || k>=a.length){
            System.out.println("IndexOutOfBoundsException");
            return;
        }
        for(int i=a.length-2;i>=k;i--){
            a[i+1] = a[i];
        }
        a[k]=y;
    }
    public void InsetO(int[] a,int y,boolean t){
        int k = CheckO(a,y,t);
        if(k<0 || k>=a.length){
            System.out.println("IndexOutOfBoundsException");
            return;
        }
        for(int i=a.length-2;i>=k;i--){
            a[i+1] = a[i];
        }
        a[k]=y;
    }
    public void InsetO(long[] a,long y,boolean t){
        int k = CheckO(a,y,t);
        if(k<0 || k>=a.length){
            System.out.println("IndexOutOfBoundsException");
            return;
        }
        for(int i=a.length-2;i>=k;i--){
            a[i+1] = a[i];
        }
        a[k]=y;
    }
    public void InsetO(float[] a,float y,boolean t){
        int k = CheckO(a,y,t);
        if(k<0 || k>=a.length){
            System.out.println("IndexOutOfBoundsException");
            return;
        }
        for(int i=a.length-2;i>=k;i--){
            a[i+1] = a[i];
        }
        a[k]=y;
    }
    public void InsetO(double[] a,double y,boolean t){
        int k = CheckO(a,y,t);
        if(k<0 || k>=a.length){
            System.out.println("IndexOutOfBoundsException");
            return;
        }
        for(int i=a.length-2;i>=k;i--){
            a[i+1] = a[i];
        }
        a[k]=y;
    }
    public void InsetO(char[] a,char y,boolean t){
        int k = CheckO(a,y,t);
        if(k<0 || k>=a.length){
            System.out.println("IndexOutOfBoundsException");
            return;
        }
        for(int i=a.length-2;i>=k;i--){
            a[i+1] = a[i];
        }
        a[k]=y;
    }


    /**
     * 删除  无序数组 下标为x的数
     * @param a
     * @param x
     */
    public void DeleteU(byte[] a,byte x){
        int k = CheckU(a,x);
        if(k<0 || k>=a.length){
            System.out.println("IndexOutOfBoundsException");
            return;
        }
        for(int i=k;i<a.length;i++){
            a[i] = a[i+1];
        }
    }
    public void DeleteU(short[] a,short x){
        int k = CheckU(a,x);
        if(k<0 || k>=a.length){
            System.out.println("IndexOutOfBoundsException");
            return;
        }
        for(int i=k;i<a.length;i++){
            a[i] = a[i+1];
        }
    }
    public void DeleteU(int[] a,int x){
        int k = CheckU(a,x);
        if(k<0 || k>=a.length){
            System.out.println("IndexOutOfBoundsException");
            return;
        }
        for(int i=k;i<a.length;i++){
            a[i] = a[i+1];
        }
     }
    public void DeleteU(long[] a,long x){
        int k = CheckU(a,x);
        if(k<0 || k>=a.length){
            System.out.println("IndexOutOfBoundsException");
            return;
        }
        for(int i=k;i<a.length;i++){
            a[i] = a[i+1];
        }
    }
    public void DeleteU(float[] a,float x){
        int k = CheckU(a,x);
        if(k<0 || k>=a.length){
            System.out.println("IndexOutOfBoundsException");
            return;
        }
        for(int i=k;i<a.length;i++){
            a[i] = a[i+1];
        }
    }
    public void DeleteU(double[] a,double x){
        int k = CheckU(a,x);
        if(k<0 || k>=a.length){
            System.out.println("IndexOutOfBoundsException");
            return;
        }
        for(int i=k;i<a.length;i++){
            a[i] = a[i+1];
        }
    }
    public void DeleteU(char[] a,char x){
        int k = CheckU(a,x);
        if(k<0 || k>=a.length){
            System.out.println("IndexOutOfBoundsException");
            return;
        }
        for(int i=k;i<a.length;i++){
            a[i] = a[i+1];
        }
    }
    /**
     * 删除  有序数组 下标为x的数
     * @param a
     * @param x
     */
    public void DeleteO(byte[] a,byte x){
        int k = CheckO(a,x);
        if(k<0 || k>=a.length){
            System.out.println("IndexOutOfBoundsException");
            return;
        }
        for(int i=k;i<a.length;i++){
            a[i] = a[i+1];
        }
    }
    public void DeleteO(short[] a,short x){
        int k = CheckO(a,x);
        if(k<0 || k>=a.length){
            System.out.println("IndexOutOfBoundsException");
            return;
        }
        for(int i=k;i<a.length;i++){
            a[i] = a[i+1];
        }
    }
    public void DeleteO(int[] a,int x){
        int k = CheckO(a,x);
        if(k<0 || k>=a.length){
            System.out.println("IndexOutOfBoundsException");
            return;
        }
        for(int i=k;i<a.length;i++){
            a[i] = a[i+1];
        }
    }
    public void DeleteO(long[] a,long x){
        int k = CheckO(a,x);
        if(k<0 || k>=a.length){
            System.out.println("IndexOutOfBoundsException");
            return;
        }
        for(int i=k;i<a.length;i++){
            a[i] = a[i+1];
        }
    }
    public void DeleteO(float[] a,float x){
        int k = CheckO(a,x);
        if(k<0 || k>=a.length){
            System.out.println("IndexOutOfBoundsException");
            return;
        }
        for(int i=k;i<a.length;i++){
            a[i] = a[i+1];
        }
    }
    public void DeleteO(double[] a,double x){
        int k = CheckO(a,x);
        if(k<0 || k>=a.length){
            System.out.println("IndexOutOfBoundsException");
            return;
        }
        for(int i=k;i<a.length;i++){
            a[i] = a[i+1];
        }
    }
    public void DeleteO(char[] a,char x){
        int k = CheckO(a,x);
        if(k<0 || k>=a.length){
            System.out.println("IndexOutOfBoundsException");
            return;
        }
        for(int i=k;i<a.length;i++){
            a[i] = a[i+1];
        }
    }
    /**
     * 无序数组 删除所有与y相同的值
     * @param a
     * @param y
     */
    public void DeleteUAll(byte[] a,byte y){
        int[] b = new int[a.length];
        b = CheckUAll(a,y);
        for(int i=0;i<b.length;i++){
            for(int j=b[i];j<a.length;j++){
                a[j]=a[j+1];
            }
        }
    }
    public void DeleteUAll(short[] a,short y){
        int[] b = new int[a.length];
        b = CheckUAll(a,y);
        for(int i=0;i<b.length;i++){
            for(int j=b[i];j<a.length;j++){
                a[j]=a[j+1];
            }
        }
    }
    public void DeleteUAll(int[] a,int y){
        int[] b = new int[a.length];
        b = CheckUAll(a,y);
        for(int i=0;i<b.length;i++){
            for(int j=b[i];j<a.length;j++){
                a[j]=a[j+1];
            }
        }
    }
    public void DeleteUAll(long[] a,long y){
        int[] b = new int[a.length];
        b = CheckUAll(a,y);
        for(int i=0;i<b.length;i++){
            for(int j=b[i];j<a.length;j++){
                a[j]=a[j+1];
            }
        }
    }
    public void DeleteUAll(float[] a,float y){
        int[] b = new int[a.length];
        b = CheckUAll(a,y);
        for(int i=0;i<b.length;i++){
            for(int j=b[i];j<a.length;j++){
                a[j]=a[j+1];
            }
        }
    }
    public void DeleteUAll(double[] a,double y){
        int[] b = new int[a.length];
        b = CheckUAll(a,y);
        for(int i=0;i<b.length;i++){
            for(int j=b[i];j<a.length;j++){
                a[j]=a[j+1];
            }
        }
    }
    public void DeleteUAll(char[] a,char y){
        int[] b = new int[a.length];
        b = CheckUAll(a,y);
        for(int i=0;i<b.length;i++){
            for(int j=b[i];j<a.length;j++){
                a[j]=a[j+1];
            }
        }
    }


    /**
     * 从i到j处都填充为y
     * @param i
     * @param j
     * @param y
     * @param a
     */
    public void Fill(int i,int j,byte y,byte[] a){
        if(i<j && i>=0 && j<a.length){
            for(int x=i;x<=j;j++){
                a[x]=y;
            }
        }
    }
    public void Fill(int i,int j,short y,short[] a){
        if(i<j && i>=0 && j<a.length){
            for(int x=i;x<=j;j++){
                a[x]=y;
            }
        }
    }
    public void Fill(int i,int j,int y,int[] a){
        if(i<j && i>=0 && j<a.length){
            for(int x=i;x<=j;j++){
                a[x]=y;
            }
        }
    }
    public void Fill(int i,int j,long y,long[] a){
        if(i<j && i>=0 && j<a.length){
            for(int x=i;x<=j;j++){
                a[x]=y;
            }
        }
    }
    public void Fill(int i,int j,float y,float[] a){
        if(i<j && i>=0 && j<a.length){
            for(int x=i;x<=j;j++){
                a[x]=y;
            }
        }
    }
    public void Fill(int i,int j,double y,double[] a){
        if(i<j && i>=0 && j<a.length){
            for(int x=i;x<=j;j++){
                a[x]=y;
            }
        }
    }
    public void Fill(int i,int j,char y,char[] a){
        if(i<j && i>=0 && j<a.length){
            for(int x=i;x<=j;j++){
                a[x]=y;
            }
        }
    }


    /**
     * 查找一个下标  无序数组
     * @author moj
     * 给定一个值，查询下标
     * 数组a是无序数组
     */
    public int CheckU(byte[] a,byte y){
        int i;
        for(i=0;i<a.length-1;i++){
            if(a[i]==y){
                return i;
            }
        }
        System.out.println("Not Found");
        return i;
    }
    public int CheckU(short[] a,short y){
        int i;
        for(i=0;i<a.length-1;i++){
            if(a[i]==y){
                return i;
            }
        }
        System.out.println("Not Found");
        return i;
    }
    public int CheckU(int[] a,int y){
        int i;
        for(i=0;i<a.length-1;i++){
            if(a[i]==y){
                return i;
            }
        }
        System.out.println("Not Found");
        return i;
    }
    public int CheckU(long[] a,long y){
        int i;
        for(i=0;i<a.length-1;i++){
            if(a[i]==y){
                return i;
            }
        }
        System.out.println("Not Found");
        return i;
    }
    public int CheckU(float[] a,float y){
        int i;
        for(i=0;i<a.length-1;i++){
            if(a[i]==y){
                return i;
            }
        }
        System.out.println("Not Found");
        return i;
    }
    public int CheckU(double[] a,double y){
        int i;
        for(i=0;i<a.length-1;i++){
            if(a[i]==y){
                return i;
            }
        }
        System.out.println("Not Found");
        return i;
    }
    public int CheckU(char[] a,char y){
        int i;
        for(i=0;i<a.length-1;i++){
            if(a[i]==y){
                return i;
            }
        }
        System.out.println("Not Found");
        return i;
    }
    /**
     * 查找所有下标  无序数组
     * @author moj
     * 给定一个值，找出所有下标
     * 数组a无序
     */
    public int[] CheckUAll(byte[] a,byte y){
        int[] result = new int[a.length];
        int j=0;
        for(int i=0;i<a.length;i++){
            if(a[i]==y){
                result[j]=i;
                j++;
            }
        }
        return result;
    }
    public int[] CheckUAll(short[] a,short y){
        int[] result = new int[a.length];
        int j=0;
        for(int i=0;i<a.length;i++){
            if(a[i]==y){
                result[j]=i;
                j++;
            }
        }
        return result;
    }
    public int[] CheckUAll(int[] a,int y){
        int[] result = new int[a.length];
        int j=0;
        for(int i=0;i<a.length;i++){
            if(a[i]==y){
                result[j]=i;
                j++;
            }
        }
        return result;
    }
    public int[] CheckUAll(long[] a,long y){
        int[] result = new int[a.length];
        int j=0;
        for(int i=0;i<a.length;i++){
            if(a[i]==y){
                result[j]=i;
                j++;
            }
        }
        return result;
    }
    public int[] CheckUAll(float[] a,float y){
        int[] result = new int[a.length];
        int j=0;
        for(int i=0;i<a.length;i++){
            if(a[i]==y){
                result[j]=i;
                j++;
            }
        }
        return result;
    }
    public int[] CheckUAll(double[] a,double y){
        int[] result = new int[a.length];
        int j=0;
        for(int i=0;i<a.length;i++){
            if(a[i]==y){
                result[j]=i;
                j++;
            }
        }
        return result;
    }
    public int[] CheckUAll(char[] a,char y){
        int[] result = new int[a.length];
        int j=0;
        for(int i=0;i<a.length;i++){
            if(a[i]==y){
                result[j]=i;
                j++;
            }
        }
        return result;
    }

    /**
     * 有序数组查找，默认升序
     * @param a
     * @param y
     * @return i
     */
    public int CheckO(byte[] a,byte y){
        int i,j,m;
        for(i=0,j=a.length-1;i<=j;){
            m=(i+j)/2;
            if(y==a[m]) return m;
            else if(y>a[m]) i=m+1;
            else j=m-1;
        }
        return i;
    }
    public int CheckO(short[] a,short y){
        int i,j,m;
        for(i=0,j=a.length-1;i<=j;){
            m=(i+j)/2;
            if(y==a[m]) return m;
            else if(y>a[m]) i=m+1;
            else j=m-1;
        }
        return i;
    }
    public int CheckO(int[] a,int y){
        int i,j,m;
        for(i=0,j=a.length-1;i<=j;){
            m=(i+j)/2;
            if(y==a[m]) return m;
            else if(y>a[m]) i=m+1;
            else j=m-1;
        }
        return i;
    }
    public int CheckO(long[] a,long y){
        int i,j,m;
        for(i=0,j=a.length-1;i<=j;){
            m=(i+j)/2;
            if(y==a[m]) return m;
            else if(y>a[m]) i=m+1;
            else j=m-1;
        }
        return i;
    }
    public int CheckO(float[] a,float y){
        int i,j,m;
        for(i=0,j=a.length-1;i<=j;){
            m=(i+j)/2;
            if(y==a[m]) return m;
            else if(y>a[m]) i=m+1;
            else j=m-1;
        }
        return i;
    }
    public int CheckO(double[] a,double y){
        int i,j,m;
        for(i=0,j=a.length-1;i<=j;){
            m=(i+j)/2;
            if(y==a[m]) return m;
            else if(y>a[m]) i=m+1;
            else j=m-1;
        }
        return i;
    }
    public int CheckO(char[] a,char y){
        int i,j,m;
        for(i=0,j=a.length-1;i<=j;){
            m=(i+j)/2;
            if(y==a[m]) return m;
            else if(y>a[m]) i=m+1;
            else j=m-1;
        }
        return i;
    }
    /**
     * 有序数组查找  降序
     * @param a
     * @param y
     * @param t
     * @return
     */
    public int CheckO(byte[] a,byte y,boolean t){
        int k;
        if(t) k=CheckO(a,y);
        else{
            int i,j,m;
            for(i=0,j=a.length-1;i<=j;){
                m=(i+j)/2;
                if(y==a[m]) k=m;
                else if(y<a[m]) i=m+1;
                else j=m-1;
            }
            k=i;
        }
        return k;
    }
    public int CheckO(short[] a,short y,boolean t){
        int k;
        if(t) k=CheckO(a,y);
        else{
            int i,j,m;
            for(i=0,j=a.length-1;i<=j;){
                m=(i+j)/2;
                if(y==a[m]) k=m;
                else if(y<a[m]) i=m+1;
                else j=m-1;
            }
            k=i;
        }
        return k;
    }
    public int CheckO(int[] a,int y,boolean t){
        int k;
        if(t) k=CheckO(a,y);
        else{
            int i,j,m;
            for(i=0,j=a.length-1;i<=j;){
                m=(i+j)/2;
                if(y==a[m]) k=m;
                else if(y<a[m]) i=m+1;
                else j=m-1;
            }
            k=i;
        }
        return k;
    }
    public int CheckO(long[] a,long y,boolean t){
        int k;
        if(t) k=CheckO(a,y);
        else{
            int i,j,m;
            for(i=0,j=a.length-1;i<=j;){
                m=(i+j)/2;
                if(y==a[m]) k=m;
                else if(y<a[m]) i=m+1;
                else j=m-1;
            }
            k=i;
        }
        return k;
    }
    public int CheckO(float[] a,float y,boolean t){
        int k;
        if(t) k=CheckO(a,y);
        else{
            int i,j,m;
            for(i=0,j=a.length-1;i<=j;){
                m=(i+j)/2;
                if(y==a[m]) k=m;
                else if(y<a[m]) i=m+1;
                else j=m-1;
            }
            k=i;
        }
        return k;
    }
    public int CheckO(double[] a,double y,boolean t){
        int k;
        if(t) k=CheckO(a,y);
        else{
            int i,j,m;
            for(i=0,j=a.length-1;i<=j;){
                m=(i+j)/2;
                if(y==a[m]) k=m;
                else if(y<a[m]) i=m+1;
                else j=m-1;
            }
            k=i;
        }
        return k;
    }
    public int CheckO(char[] a,char y,boolean t){
        int k;
        if(t) k=CheckO(a,y);
        else{
            int i,j,m;
            for(i=0,j=a.length-1;i<=j;){
                m=(i+j)/2;
                if(y==a[m]) k=m;
                else if(y<a[m]) i=m+1;
                else j=m-1;
            }
            k=i;
        }
        return k;
    }


    /**
     * 排序  升序
     * @author moj
     * 分为升降序
     * 默认升序
     */
    public void Sort(byte[] a){
        byte b;
        for(int i=0;i<a.length-1;i++){
            boolean k=true;
            for(int j=0;j<a.length-1-i;j++){
                if(a[j+1]<a[j]){
                    b=a[j+1];
                    a[j+1]=a[j];
                    a[j]=b;
                    k=false;
                }
            }
            if(k) break;
        }
    }
    public void Sort(short[] a){
        short b;
        for(int i=0;i<a.length-1;i++){
            boolean k=true;
            for(int j=0;j<a.length-1-i;j++){
                if(a[j+1]<a[j]){
                    b=a[j+1];
                    a[j+1]=a[j];
                    a[j]=b;
                    k=false;
                }
            }
            if(k) break;
        }
    }
    public void Sort(int[] a){
        int b;
        for(int i=0;i<a.length-1;i++){
            boolean k=true;
            for(int j=0;j<a.length-1-i;j++){
                if(a[j+1]<a[j]){
                    b=a[j+1];
                    a[j+1]=a[j];
                    a[j]=b;
                    k=false;
                }
            }
            if(k) break;
        }
    }
    public void Sort(long[] a){
        long b;
        for(int i=0;i<a.length-1;i++){
            boolean k=true;
            for(int j=0;j<a.length-1-i;j++){
                if(a[j+1]<a[j]){
                    b=a[j+1];
                    a[j+1]=a[j];
                    a[j]=b;
                    k=false;
                }
            }
            if(k) break;
        }
    }
    public void Sort(float[] a){
        float b;
        for(int i=0;i<a.length-1;i++){
            boolean k=true;
            for(int j=0;j<a.length-1-i;j++){
                if(a[j+1]<a[j]){
                    b=a[j+1];
                    a[j+1]=a[j];
                    a[j]=b;
                    k=false;
                }
            }
            if(k) break;
        }
    }
    public void Sort(double[] a){
        double b;
        for(int i=0;i<a.length-1;i++){
            boolean k=true;
            for(int j=0;j<a.length-1-i;j++){
                if(a[j+1]<a[j]){
                    b=a[j+1];
                    a[j+1]=a[j];
                    a[j]=b;
                    k=false;
                }
            }
            if(k) break;
        }
    }
    public void Sort(char[] a){
        char b;
        for(int i=0;i<a.length-1;i++){
            boolean k=true;
            for(int j=0;j<a.length-1-i;j++){
                if(a[j+1]<a[j]){
                    b=a[j+1];
                    a[j+1]=a[j];
                    a[j]=b;
                    k=false;
                }
            }
            if(k) break;
        }
    }
    /**排序  降序
     * @author moj
     * @param a
     * @param t
     */
    public void Sort(byte[] a,boolean t){
        if(t) Sort(a);
        else{
            byte b;
            for(int i=0;i<a.length-1;i++){
                boolean k=true;
                for(int j=0;j<a.length-1-i;j++){
                    if(a[j+1]>a[j]){
                        b=a[j+1];
                        a[j+1]=a[j];
                        a[j]=b;
                        k=false;
                    }
                }
                if(k) break;
            }
        }

    }
    public void Sort(short[] a,boolean t){
        if(t) Sort(a);
        else{
            short b;
            for(int i=0;i<a.length-1;i++){
                boolean k=true;
                for(int j=0;j<a.length-1-i;j++){
                    if(a[j+1]>a[j]){
                        b=a[j+1];
                        a[j+1]=a[j];
                        a[j]=b;
                        k=false;
                    }
                }
                if(k) break;
            }
        }

    }
    public void Sort(int[] a,boolean t){
        if(t) Sort(a);
        else{
            int b;
            for(int i=0;i<a.length-1;i++){
                boolean k=true;
                for(int j=0;j<a.length-1-i;j++){
                    if(a[j+1]>a[j]){
                        b=a[j+1];
                        a[j+1]=a[j];
                        a[j]=b;
                        k=false;
                    }
                }
                if(k) break;
            }
        }

    }
    public void Sort(long[] a,boolean t){
        if(t) Sort(a);
        else{
            long b;
            for(int i=0;i<a.length-1;i++){
                boolean k=true;
                for(int j=0;j<a.length-1-i;j++){
                    if(a[j+1]>a[j]){
                        b=a[j+1];
                        a[j+1]=a[j];
                        a[j]=b;
                        k=false;
                    }
                }
                if(k) break;
            }
        }

    }
    public void Sort(float[] a,boolean t){
        if(t) Sort(a);
        else{
            float b;
            for(int i=0;i<a.length-1;i++){
                boolean k=true;
                for(int j=0;j<a.length-1-i;j++){
                    if(a[j+1]>a[j]){
                        b=a[j+1];
                        a[j+1]=a[j];
                        a[j]=b;
                        k=false;
                    }
                }
                if(k) break;
            }
        }

    }
    public void Sort(double[] a,boolean t){
        if(t) Sort(a);
        else{
            double b;
            for(int i=0;i<a.length-1;i++){
                boolean k=true;
                for(int j=0;j<a.length-1-i;j++){
                    if(a[j+1]>a[j]){
                        b=a[j+1];
                        a[j+1]=a[j];
                        a[j]=b;
                        k=false;
                    }
                }
                if(k) break;
            }
        }

    }
    public void Sort(char[] a,boolean t){
        if(t) Sort(a);
        else{
            char b;
            for(int i=0;i<a.length-1;i++){
                boolean k=true;
                for(int j=0;j<a.length-1-i;j++){
                    if(a[j+1]>a[j]){
                        b=a[j+1];
                        a[j+1]=a[j];
                        a[j]=b;
                        k=false;
                    }
                }
                if(k) break;
            }
        }

    }


    /**遍历
     * @author moj
     * @param a
     */
    public void print(byte[] a){
        for(int i=0;i<a.length;i++){
            System.out.printf("%d ",a[i]);
        }
    }
    public void print(short[] a){
        for(int i=0;i<a.length;i++){
            System.out.printf("%d ",a[i]);
        }
    }
    public void print(int[] a){
        for(int i=0;i<a.length;i++){
            System.out.printf("%d ",a[i]);
        }
    }
    public void print(long[] a){
        for(int i=0;i<a.length;i++){
            System.out.printf("%d ",a[i]);
        }
    }
    public void print(float[] a){
        for(int i=0;i<a.length;i++){
            System.out.printf("%d ",a[i]);
        }
    }
    public void print(double[] a){
        for(int i=0;i<a.length;i++){
            System.out.printf("%d ",a[i]);
        }
    }
    public void print(char[] a){
        for(int i=0;i<a.length;i++){
            System.out.printf("%d ",a[i]);
        }
    }

}
